Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

esUtil.h File Reference

#include <GLES2/gl2.h>
#include <EGL/egl.h>

Go to the source code of this file.

Data Structures

struct  ESMatrix
struct  ESContext

Defines

#define ESUTIL_API   __cdecl
#define ESCALLBACK   __cdecl
#define ES_WINDOW_RGB   0
 esCreateWindow flag - RGB color buffer

#define ES_WINDOW_ALPHA   1
 esCreateWindow flag - ALPHA color buffer

#define ES_WINDOW_DEPTH   2
 esCreateWindow flag - depth buffer

#define ES_WINDOW_STENCIL   4
 esCreateWindow flag - stencil buffer

#define ES_WINDOW_MULTISAMPLE   8
 esCreateWindow flat - multi-sample buffer


Functions

void ESUTIL_API esInitContext (ESContext *esContext)
 Initialize ES framework context. This must be called before calling any other functions.

GLboolean ESUTIL_API esCreateWindow (ESContext *esContext, const char *title, GLint width, GLint height, GLuint flags)
 Create a window with the specified parameters.

void ESUTIL_API esMainLoop (ESContext *esContext)
 Start the main loop for the OpenGL ES application.

void ESUTIL_API esRegisterDrawFunc (ESContext *esContext, void(ESCALLBACK *drawFunc)(ESContext *))
 Register a draw callback function to be used to render each frame.

void ESUTIL_API esRegisterUpdateFunc (ESContext *esContext, void(ESCALLBACK *updateFunc)(ESContext *, float))
 Register an update callback function to be used to update on each time step.

void ESUTIL_API esRegisterKeyFunc (ESContext *esContext, void(ESCALLBACK *drawFunc)(ESContext *, unsigned char, int, int))
 Register an keyboard input processing callback function.

void ESUTIL_API esLogMessage (const char *formatStr,...)
 Log a message to the debug output for the platform.

GLuint ESUTIL_API esLoadShader (GLenum type, const char *shaderSrc)
 Load a shader, check for compile errors, print error messages to output log.

GLuint ESUTIL_API esLoadProgram (const char *vertShaderSrc, const char *fragShaderSrc)
 Load a vertex and fragment shader, create a program object, link program. Errors output to log.

int ESUTIL_API esGenSphere (int numSlices, float radius, GLfloat **vertices, GLfloat **normals, GLfloat **texCoords, GLuint **indices)
 Generates geometry for a sphere. Allocates memory for the vertex data and stores the results in the arrays. Generate index list for a TRIANGLE_STRIP.

int ESUTIL_API esGenCube (float scale, GLfloat **vertices, GLfloat **normals, GLfloat **texCoords, GLuint **indices)
 Generates geometry for a cube. Allocates memory for the vertex data and stores the results in the arrays. Generate index list for a TRIANGLES.

char *ESUTIL_API esLoadTGA (char *fileName, int *width, int *height)
 Loads a 24-bit TGA image from a file.

void ESUTIL_API esScale (ESMatrix *result, GLfloat sx, GLfloat sy, GLfloat sz)
 multiply matrix specified by result with a scaling matrix and return new matrix in result

void ESUTIL_API esTranslate (ESMatrix *result, GLfloat tx, GLfloat ty, GLfloat tz)
 multiply matrix specified by result with a translation matrix and return new matrix in result

void ESUTIL_API esRotate (ESMatrix *result, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
 multiply matrix specified by result with a rotation matrix and return new matrix in result

void ESUTIL_API esFrustum (ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ)
void ESUTIL_API esPerspective (ESMatrix *result, float fovy, float aspect, float nearZ, float farZ)
 multiply matrix specified by result with a perspective matrix and return new matrix in result

void ESUTIL_API esOrtho (ESMatrix *result, float left, float right, float bottom, float top, float nearZ, float farZ)
 multiply matrix specified by result with a perspective matrix and return new matrix in result

void ESUTIL_API esMatrixMultiply (ESMatrix *result, ESMatrix *srcA, ESMatrix *srcB)
 perform the following operation - result matrix = srcA matrix * srcB matrix

void ESUTIL_API esMatrixLoadIdentity (ESMatrix *result)


Define Documentation

#define ES_WINDOW_ALPHA   1
 

esCreateWindow flag - ALPHA color buffer

#define ES_WINDOW_DEPTH   2
 

esCreateWindow flag - depth buffer

#define ES_WINDOW_MULTISAMPLE   8
 

esCreateWindow flat - multi-sample buffer

#define ES_WINDOW_RGB   0
 

esCreateWindow flag - RGB color buffer

#define ES_WINDOW_STENCIL   4
 

esCreateWindow flag - stencil buffer

#define ESCALLBACK   __cdecl
 

#define ESUTIL_API   __cdecl
 


Function Documentation

GLboolean ESUTIL_API esCreateWindow ESContext esContext,
const char *  title,
GLint  width,
GLint  height,
GLuint  flags
 

Create a window with the specified parameters.

Parameters:
esContext Application context
title Name for title bar of window
width Width in pixels of window to create
height Height in pixels of window to create
flags Bitfield for the window creation flags ES_WINDOW_RGB - specifies that the color buffer should have R,G,B channels ES_WINDOW_ALPHA - specifies that the color buffer should have alpha ES_WINDOW_DEPTH - specifies that a depth buffer should be created ES_WINDOW_STENCIL - specifies that a stencil buffer should be created ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
Returns:
GL_TRUE if window creation is succesful, GL_FALSE otherwise

void ESUTIL_API esFrustum ESMatrix result,
float  left,
float  right,
float  bottom,
float  top,
float  nearZ,
float  farZ
 

Parameters:
result Specifies the input matrix. new matrix is returned in result.
left,right Coordinates for the left and right vertical clipping planes
bottom,top Coordinates for the bottom and top horizontal clipping planes
nearZ,farZ Distances to the near and far depth clipping planes. Both distances must be +ve.

int ESUTIL_API esGenCube float  scale,
GLfloat **  vertices,
GLfloat **  normals,
GLfloat **  texCoords,
GLuint **  indices
 

Generates geometry for a cube. Allocates memory for the vertex data and stores the results in the arrays. Generate index list for a TRIANGLES.

Parameters:
scale The size of the cube, use 1.0 for a unit cube.
vertices If not NULL, will contain array of float3 positions
normals If not NULL, will contain array of float3 normals
texCoords If not NULL, will contain array of float2 texCoords
indices If not NULL, will contain the array of indices for the triangle strip
Returns:
The number of indices required for rendering the buffers (the number of indices stored in the indices array if it is not NULL ) as a GL_TRIANGLE_STRIP

int ESUTIL_API esGenSphere int  numSlices,
float  radius,
GLfloat **  vertices,
GLfloat **  normals,
GLfloat **  texCoords,
GLuint **  indices
 

Generates geometry for a sphere. Allocates memory for the vertex data and stores the results in the arrays. Generate index list for a TRIANGLE_STRIP.

Parameters:
numSlices The number of slices in the sphere
vertices If not NULL, will contain array of float3 positions
normals If not NULL, will contain array of float3 normals
texCoords If not NULL, will contain array of float2 texCoords
indices If not NULL, will contain the array of indices for the triangle strip
Returns:
The number of indices required for rendering the buffers (the number of indices stored in the indices array if it is not NULL ) as a GL_TRIANGLE_STRIP

void ESUTIL_API esInitContext ESContext esContext  ) 
 

Initialize ES framework context. This must be called before calling any other functions.

Parameters:
esContext Application context

GLuint ESUTIL_API esLoadProgram const char *  vertShaderSrc,
const char *  fragShaderSrc
 

Load a vertex and fragment shader, create a program object, link program. Errors output to log.

Parameters:
vertShaderSrc Vertex shader source code
fragShaderSrc Fragment shader source code
Returns:
A new program object linked with the vertex/fragment shader pair, 0 on failure

GLuint ESUTIL_API esLoadShader GLenum  type,
const char *  shaderSrc
 

Load a shader, check for compile errors, print error messages to output log.

Parameters:
type Type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
shaderSrc Shader source string
Returns:
A new shader object on success, 0 on failure

char* ESUTIL_API esLoadTGA char *  fileName,
int *  width,
int *  height
 

Loads a 24-bit TGA image from a file.

Parameters:
fileName Name of the file on disk
width Width of loaded image in pixels
height Height of loaded image in pixels
Returns:
Pointer to loaded image. NULL on failure.

void ESUTIL_API esLogMessage const char *  formatStr,
... 
 

Log a message to the debug output for the platform.

Parameters:
formatStr Format string for error log.

void ESUTIL_API esMainLoop ESContext esContext  ) 
 

Start the main loop for the OpenGL ES application.

Parameters:
esContext Application context

void ESUTIL_API esMatrixLoadIdentity ESMatrix result  ) 
 

void ESUTIL_API esMatrixMultiply ESMatrix result,
ESMatrix srcA,
ESMatrix srcB
 

perform the following operation - result matrix = srcA matrix * srcB matrix

Parameters:
result Returns multiplied matrix
srcA,srcB Input matrices to be multiplied

void ESUTIL_API esOrtho ESMatrix result,
float  left,
float  right,
float  bottom,
float  top,
float  nearZ,
float  farZ
 

multiply matrix specified by result with a perspective matrix and return new matrix in result

Parameters:
result Specifies the input matrix. new matrix is returned in result.
left,right Coordinates for the left and right vertical clipping planes
bottom,top Coordinates for the bottom and top horizontal clipping planes
nearZ,farZ Distances to the near and far depth clipping planes. These values are -ve if plane is behind the viewer

void ESUTIL_API esPerspective ESMatrix result,
float  fovy,
float  aspect,
float  nearZ,
float  farZ
 

multiply matrix specified by result with a perspective matrix and return new matrix in result

Parameters:
result Specifies the input matrix. new matrix is returned in result.
fovy Field of view y angle in degrees
aspect Aspect ratio of screen
nearZ Near plane distance
farZ Far plane distance

void ESUTIL_API esRegisterDrawFunc ESContext esContext,
void(ESCALLBACK *drawFunc  )(ESContext *)
 

Register a draw callback function to be used to render each frame.

Parameters:
esContext Application context
drawFunc Draw callback function that will be used to render the scene

void ESUTIL_API esRegisterKeyFunc ESContext esContext,
void(ESCALLBACK *drawFunc  )(ESContext *, unsigned char, int, int)
 

Register an keyboard input processing callback function.

Parameters:
esContext Application context
keyFunc Key callback function for application processing of keyboard input

void ESUTIL_API esRegisterUpdateFunc ESContext esContext,
void(ESCALLBACK *updateFunc  )(ESContext *, float)
 

Register an update callback function to be used to update on each time step.

Parameters:
esContext Application context
updateFunc Update callback function that will be used to render the scene

void ESUTIL_API esRotate ESMatrix result,
GLfloat  angle,
GLfloat  x,
GLfloat  y,
GLfloat  z
 

multiply matrix specified by result with a rotation matrix and return new matrix in result

Parameters:
result Specifies the input matrix. Rotated matrix is returned in result.
angle Specifies the angle of rotation, in degrees.
x,y,z Specify the x, y and z coordinates of a vector, respectively

void ESUTIL_API esScale ESMatrix result,
GLfloat  sx,
GLfloat  sy,
GLfloat  sz
 

multiply matrix specified by result with a scaling matrix and return new matrix in result

Parameters:
result Specifies the input matrix. Scaled matrix is returned in result.
sx,sy,sz Scale factors along the x, y and z axes respectively

void ESUTIL_API esTranslate ESMatrix result,
GLfloat  tx,
GLfloat  ty,
GLfloat  tz
 

multiply matrix specified by result with a translation matrix and return new matrix in result

Parameters:
result Specifies the input matrix. Translated matrix is returned in result.
tx,ty,tz Scale factors along the x, y and z axes respectively


Generated on Thu Jan 31 11:29:22 2008 for ES Framework by doxygen 1.3.6